﻿
namespace YasharEl.Infrastructure.ObjectFactory
{
    public abstract class BaseDependencyContainer : IDependencyContainer
    {
        #region Protected Fields

        public IDependencyResolver DependencyResolver { get; protected set; }

        public IDependencyRegistrar DependencyRegistrar { get; protected set; }

        #endregion

        #region Abstract Public Methods

        public abstract IDependencyContainer CreateChildContainer(string containerName = null);

        public abstract IDependencyContainer FindChildContainer(string containerName);

        public abstract IDependencyRegistrationTraverser CreateContainerTraverser();

        #endregion

        #region Methods

        public void InitializeContainer()
        {
            DependencyRegistrar = CreateDependencyRegistrar();
            DependencyResolver = CreateDependencyResolver();
        }

        #endregion

        #region Abstract Subsclasses Extensions Points

        protected abstract IDependencyResolver CreateDependencyResolver();

        protected abstract IDependencyRegistrar CreateDependencyRegistrar();

        #endregion

        #region Abstract Properties

        public abstract BaseDependencyContainer Parent
        {
            get;
        }

        #endregion
    }
}
